package com.sfc.sdsr.activity;

import java.util.List;
import com.sfc.sdsr.common.model.News;
import com.sfc.sdsr.dao.DataToJava;
import com.sfc.sdsr.dao.SqliteDao;

import android.app.ListActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;

public class BulletinActivity extends ListActivity {

	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        DataToJava dataToJava = new DataToJava(this, "sfc.db", null, 3);
        SqliteDao sqliteDao = new SqliteDao(this, "sfc.db", null, 3);
        sqliteDao.setDataToJava(dataToJava);
            
        List<News> newses = sqliteDao.getNews();

        String[] newsArray = new String[newses.size()];
        for (int i=0; i< newses.size();i++) {
        	newsArray[i] = newses.get(i).toString();
        }
        ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, newsArray);
        setListAdapter(arrayAdapter);
        
    }
}
